package AjaxResult

import "net/http"

func Result(code int64, msg string, data interface{}) map[string]interface{} {
	result := make(map[string]interface{})
	result["code"] = code
	result["msg"] = msg
	if data != nil {
		result["data"] = data
	}

	return result
}

func Success(msg string, data interface{}) map[string]interface{} {
	return Result(http.StatusOK, msg, data)
}

func Error(msg string, data interface{}) map[string]interface{} {
	return Result(http.StatusInternalServerError, msg, data)
}
